package me.yuxiaoyao.lock.annotation;

import me.yuxiaoyao.lock.interceptor.DistributedLockOperation;
import org.springframework.lang.Nullable;

import java.lang.reflect.Method;
import java.util.Collection;

/**
 * @author kerryzhang on 2020/12/22
 */


public interface DistributedLockAnnotationParser {

    /**
     * is match
     *
     * @param targetClass
     * @return
     */
    default boolean isCandidateClass(Class<?> targetClass) {
        return true;
    }


    /**
     * get type all lock annotations
     *
     * @param type
     * @return
     */
    @Nullable
    Collection<DistributedLockOperation> parseDistributedLockAnnotations(Class<?> type);

    /**
     * get method all lock annotations
     *
     * @param method
     * @return
     */
    @Nullable
    Collection<DistributedLockOperation> parseDistributedLockAnnotations(Method method);
}
